package com.design.pattern.component.generation;

/**
 * 以族谱作为组合模式的样例
 * 族人分为男人和女人,两者皆计入族谱,但是女人的孩子是不能计入族谱的,嫁入的女人会被计入族谱
 * 现在要统计族谱的人数
 */
public abstract class Genealogy {
    /**
     * 族人姓名
     */
    private String name;
    /**
     * 属于第几代人
     */
    private Integer generation;
    /**
     * 身份
     */
    private String identity;

    public void setIdentity(String identity) {
        this.identity = identity;
    }

    public void setGeneration(Integer generation) {
        this.generation = generation;
    }

    public String getName() {
        return name;
    }

    public Integer getGeneration() {
        return generation;
    }

    public String getIdentity() {
        return identity;
    }

    public Genealogy(String name, Integer generation, String Identity) {
        this.name = name;
        this.generation=generation+1;
        this.identity =Identity;
    }

    public Genealogy(String name, Integer generation) {
        this.name = name;
        this.generation = generation;
    }

    /**
     * 展示自己,及其亲人
     */
    public abstract String show() ;
}
